var timer = null;


window.onload = function() {
	var div1 = document.getElementById("div1");
	div1.onmouseover = function() {
		Move(0);
	}
	div1.onmouseout = function() {
		Move(-200);
	}
}

function Move(iTarget) {
	var distance;
	var div1 = document.getElementById("div1");
	clearInterval(timer);
	timer = setInterval(function() {
		if (div1.offsetLeft < iTarget) { //to right
			console.log(iTarget);
			distance = 10;
			div1.style.left = div1.offsetLeft + distance + "px";
		}
		if (div1.offsetLeft > iTarget) { //to left
			distance = -10;
			div1.style.left = div1.offsetLeft + distance + "px";
		}

	}, 20);
}